//
// Created by 王乐 on 2022/2/16.
//

#include "LeCubicSubBoxGameObject.h"
#include "LeCubicSubBoxRenderer.h"
#include "LeCubicSubBoxBehaviour.h"

LeCubicSubBoxGameObject::LeCubicSubBoxGameObject()
{}

LeCubicSubBoxGameObject::~LeCubicSubBoxGameObject()
{

}

void LeCubicSubBoxGameObject::Initialize()
{
    strName = "MyCubicSubBox";
    m_bSelectable = true;

    // Transform
    // ---------
    m_Transform.setPosition(m_Position.x, m_Position.y, m_Position.z);
    m_Transform.setRotation(0, 0, 0);
    m_Transform.setScale(m_Scale.x, m_Scale.y, m_Scale.z);

    // RigidBody
    // ---------

    // Behaviour
    // ---------
    LeCubicSubBoxBehaviour* pBehaviour = new LeCubicSubBoxBehaviour();

    // Renderer
    // --------
    LeCubicSubBoxRenderer* pRenderer = new LeCubicSubBoxRenderer();
    pRenderer->initRenderer(this, "/Users/wangle/CLionProjects/Leste/res/shader/singlecolor.vs",
                            "/Users/wangle/CLionProjects/Leste/res/shader/singlecolor.fs");

    // Initialize Components
    initComponents(pRenderer, nullptr, pBehaviour, nullptr);
}

void LeCubicSubBoxGameObject::setParameters(float posx, float posy, float posz, float scalx, float scaly, float scalz,
                                            float r, float g, float b, float a)
{
    m_Position = glm::vec3(posx, posy, posz);
    m_Scale = glm::vec3(scalx, scaly, scalz);
    m_Color = glm::vec4(r, g, b, a);
}
